import {request} from '../utils/util';
const defaultSettings = require('../config/defaultSettings')
const cmdUrl = {
  //阀门开关
  downlinkCommandValve:defaultSettings.appServer+'/CommandDownlinkController/downlinkCommandValve',
  //开始灌溉
  downlinkCommandEqOpen:defaultSettings.appServer+'/CommandDownlinkController/downlinkCommandEqOpen',
  //停止灌溉
  downlinkCommandEqClose:defaultSettings.appServer+'/CommandDownlinkController/downlinkCommandEqClose',
  //施肥
  downlinkCommandFertigation:defaultSettings.appServer+'/CommandDownlinkController/downlinkCommandFertigation',
  //加水
  downlinkCommandWaterSupply:defaultSettings.appServer+'/CommandDownlinkController/downlinkCommandWaterSupply',
  //搅拌
  downlinkCommandAgitation:defaultSettings.appServer+'/CommandDownlinkController/downlinkCommandAgitation',
  //排沙
  downlinkCommandDesilting:defaultSettings.appServer+'/CommandDownlinkController/downlinkCommandDesilting',
  //结账
  downlinkCommandSettle:defaultSettings.appServer+'/CommandDownlinkController/downlinkCommandSettle',
}

function downlinkCommandValve(parameter){
  return request({url:cmdUrl.downlinkCommandValve,data:parameter})
}

/**
 * 开始灌溉
 */
function startIrrigation(parameter){
  return request({url:cmdUrl.downlinkCommandEqOpen,data:parameter});
}

/**
 * 停止灌溉
 */
function stopIrrigation(parameter){
  return request({url:cmdUrl.downlinkCommandEqClose,data:parameter});
}

//施肥
function downlinkCommandFertigation(parameter){
  return request({url:cmdUrl.downlinkCommandFertigation,data:parameter});
}

//加水
function downlinkCommandWaterSupply(parameter){
  return request({url:cmdUrl.downlinkCommandWaterSupply,data:parameter});
}

//搅拌
function downlinkCommandAgitation(parameter){
  return request({url:cmdUrl.downlinkCommandAgitation,data:parameter});
}

function downlinkCommandDesilting(parameter){
  return request({url:cmdUrl.downlinkCommandDesilting,data:parameter});
}
function downlinkCommandSettle(parameter){
  return request({url:cmdUrl.downlinkCommandSettle,data:parameter});
}


module.exports = {
  downlinkCommandValve,stopIrrigation,startIrrigation,downlinkCommandFertigation,downlinkCommandWaterSupply,downlinkCommandAgitation,downlinkCommandDesilting,downlinkCommandSettle
}